//
//  HWConcernViewController.m
//  JWC
//
//  Created by lanou on 16/4/6.
//  Copyright © 2016年 陈帅. All rights reserved.
//

#import "HWConcernViewController.h"
#import "HWLoginViewController.h"
#import "HWRecommendVc.h"
#import "HWTakeVc.h"

@interface HWConcernViewController ()
@property (nonatomic,strong) UIButton *recommandBtn;
@end

@implementation HWConcernViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = BackgroundColor;
    [self setupNavBar];}


- (IBAction)loginBtn:(UIButton *)sender {
    HWLoginViewController *loginVc = [[HWLoginViewController alloc]init];
    [self presentViewController:loginVc animated:YES completion:nil];

}



- (IBAction)registerBtn:(UIButton *)sender {
    HWLoginViewController *loginVc = [[HWLoginViewController alloc]init];
    [self presentViewController:loginVc animated:YES completion:nil];

}


//设置导航条
- (void)setupNavBar
{
    self.navigationItem.title = @"我的订阅";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.recommandBtn];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"推荐" style:UIBarButtonItemStylePlain target:self action:@selector(tuiBtn:)];
}

- (void)tuiBtn:(UIBarButtonItem *)tuiBtn
{
    HWTakeVc *take = [[HWTakeVc alloc]init];
    [self.navigationController pushViewController:take animated:YES];
}

- (UIButton *)recommandBtn {
    if (_recommandBtn == nil) {
        _recommandBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_recommandBtn setBackgroundImage:[UIImage imageNamed:@"friendsRecommentIcon"] forState:UIControlStateNormal];
        [_recommandBtn setBackgroundImage:[UIImage imageNamed:@"friendsRecommentIcon-click"] forState:UIControlStateHighlighted];
        _recommandBtn.size = _recommandBtn.currentBackgroundImage.size;
        
        // button点击
        [[_recommandBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
           HWRecommendVc *rcVc = [[HWRecommendVc alloc]init];
            [self.navigationController pushViewController:rcVc animated:YES];
        }];
        
    }
    return _recommandBtn;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
